home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 042a / bpl70n11.zip / MATH.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-09  |  3KB  |  115 lines

  1. { Unit Math makes some undocumented, but fully functional routines of the
  2.   coprocessor/emulator floating point package available to the user. These
  3.   functions are *not* available for REAL arithmetic in $N- mode. This unit
  4.   works correctly with real mode, DOS protected mode and Windows programs.
  5.  
  6.   Copyright (c) 1989-1993 Norbert Juffa }
  7.  
  8.  
  9. {$N+,E+}
  10.  
  11. UNIT Math;
  12.  
  13.  
  14. INTERFACE
  15.  
  16. FUNCTION Tan (X: EXTENDED): EXTENDED;
  17.  
  18. FUNCTION Log (X: EXTENDED): EXTENDED;
  19.  
  20. FUNCTION Ld  (X: EXTENDED): EXTENDED;
  21.  
  22. FUNCTION PowerOfTen (X: EXTENDED): EXTENDED;
  23.  
  24. FUNCTION PowerOfTwo (X: EXTENDED): EXTENDED;
  25.  
  26.  
  27. IMPLEMENTATION
  28.  
  29. {$IFDEF WINDOWS}
  30.  
  31. {$L WF87.OBJ}
  32.  
  33. { File WF87.OBJ is one of the files delivered by Borland with BP 7.0 RTL code }
  34.  
  35. PROCEDURE __F87_TANGENT; NEAR; EXTERNAL;
  36. PROCEDURE __F87_EXP10;   NEAR; EXTERNAL;
  37. PROCEDURE __F87_EXP2;    NEAR; EXTERNAL;
  38. PROCEDURE __F87_LOG10;   NEAR; EXTERNAL;
  39. PROCEDURE __F87_LOG2;    NEAR; EXTERNAL;
  40.  
  41.  
  42. FUNCTION Tan (X: EXTENDED): EXTENDED; ASSEMBLER;
  43. ASM
  44.    FLD   TBYTE PTR [X]   { get argument }
  45.    CALL  __F87_TANGENT
  46. END;
  47.  
  48. FUNCTION Log (X: EXTENDED): EXTENDED; ASSEMBLER;
  49. ASM
  50.    FLD   TBYTE PTR [X]    { get argument }
  51.    CALL  __F87_LOG10;
  52. END;
  53.  
  54. FUNCTION Ld  (X: EXTENDED): EXTENDED; ASSEMBLER;
  55. ASM
  56.    FLD   TBYTE PTR [X]    { get argument }
  57.    CALL  __F87_LOG2;
  58. END;
  59.  
  60. FUNCTION PowerOfTen (X: EXTENDED): EXTENDED; ASSEMBLER;
  61. ASM
  62.    FLD   TBYTE PTR [X]    { get argument }
  63.    CALL  __F87_EXP10;
  64. END;
  65.  
  66. FUNCTION PowerOfTwo (X: EXTENDED): EXTENDED; ASSEMBLER;
  67. ASM
  68.    FLD   TBYTE PTR [X]    { get argument }
  69.    CALL  __F87_EXP2;
  70. END;
  71.  
  72.  
  73. {$ELSE}
  74.  
  75.  
  76. FUNCTION Tan (X: EXTENDED): EXTENDED; ASSEMBLER;
  77. ASM
  78.    FLD   TBYTE PTR [X]    { get argument }
  79.    INT   3Eh              { call shortcut interrupt }
  80.    DW    90F0h            { signal Tan wanted to shortcut handler }
  81. END;
  82.  
  83. FUNCTION Log (X: EXTENDED): EXTENDED; ASSEMBLER;
  84. ASM
  85.    FLD   TBYTE PTR [X]    { get argument }
  86.    INT   3Eh              { call shortcut interrupt }
  87.    DW    90F8h            { signal Log10 wanted to shortcut handler }
  88. END;
  89.  
  90. FUNCTION Ld  (X: EXTENDED): EXTENDED; ASSEMBLER;
  91. ASM
  92.    FLD   TBYTE PTR [X]    { get argument }
  93.    INT   3Eh              { call shortcut interrupt }
  94.    DW    90F6h            { signal Log2 wanted to shortcut handler }
  95. END;
  96.  
  97. FUNCTION PowerOfTen (X: EXTENDED): EXTENDED; ASSEMBLER;
  98. ASM
  99.    FLD   TBYTE PTR [X]    { get argument }
  100.    INT   3Eh              { call shortcut interrupt }
  101.    DW    90FEh            { signal Power of 10 wanted to shortcut handler}
  102. END;
  103.  
  104. FUNCTION PowerOfTwo (X: EXTENDED): EXTENDED; ASSEMBLER;
  105. ASM
  106.    FLD   TBYTE PTR [X]    { get argument }
  107.    INT   3Eh              { call shortcut interrupt }
  108.    DW    90FCh            { signal Power of 2 wanted to shortcut handler }
  109. END;
  110.  
  111.  
  112. {$ENDIF}
  113.  
  114. END. { Math }
  115.